package net.huashitong.ssydt.provider.article.service;


import net.huashitong.ssydt.article.entity.SsArticlePraiseRecord;
import net.huashitong.ssydt.provider.article.mapper.SsArticlePraiseRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.22
 */
@Service
@Transactional
public class SsArticlePraiseRecordServiceImpl implements SsArticlePraiseRecordService {

    private SsArticlePraiseRecordMapper mapper;

    @Autowired
    public SsArticlePraiseRecordServiceImpl(SsArticlePraiseRecordMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SsArticlePraiseRecord record) {
        return mapper.insert(record);
    }

    @Override
    public int insertSelective(SsArticlePraiseRecord record) {
        return mapper.insertSelective(record);
    }

    @Override
    public SsArticlePraiseRecord selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SsArticlePraiseRecord record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SsArticlePraiseRecord record) {
        return mapper.updateByPrimaryKey(record);
    }

    @Override
    public SsArticlePraiseRecord getByUserIdWithArticleId(String userId, Long articleId) {
        SsArticlePraiseRecord record = new SsArticlePraiseRecord();
        record.setUserId(userId);
        record.setArticleId(articleId);
        return mapper.getByUserIdWithArticleId(record);
    }
}
